#include <iostream>
using std::cout;
using std::endl;

class Point{
public:
    Point(int x,int y)
    : _ix(x)
    , _iy(y)
    {}

    void print() const{
        cout << "(" << _ix
            << "," << _iy
            << ")" << endl;
    }
protected:
    int _ix;
    int getY() const{ return _iy; }
private:
    int _iy;
};

class Point3D
: protected Point//对Point进行公有继承
{
public:
    Point3D(int x,int y,int z)
    : Point(x,y)
    , _iz(z)
    {}

    void display() const{
        cout << "(" << _ix
            /* << "," << _iy */
            << "," << getY()
            << "," << _iz
            << ")" << endl;
    }

protected:

private:
    int _iz;
};

class Point4D
: protected Point3D
{
    void show() const{
        cout << _ix << endl;
    }
};

void test0(){
    Point3D pt3d(1,2,3);
    cout << sizeof(Point) << endl;
    cout << sizeof(Point3D) << endl;
    /* pt3d.print(); */
    //Point3d有继承自基类的数据成员
    //但是不能直接访问
    /* cout << pt3d._ix << endl; */
    /* cout << pt3d._iy << endl; */
}

int main(void){
    test0();
    return 0;
}
